﻿$(function () {
    var btnInit = new ButtonInit();
    btnInit.Init();
    var AreaIDs = $('#hidAreaIDs').val();
    var LoadingFailed = $('#Successful').val() == 0;
    if (IsUndefinedOrNull(AreaIDs) && !LoadingFailed) {
        AlertMessage("alert", "输入信息错误提示！", "加载区划地址数据丢失，请联系管理员！", "", false, 0, true, true);
    }
    loadingAreaData(AreaIDs, isDisabled = true);
});

var ButtonInit = function () {
    var oInit = new Object();
    oInit.Init = function () {
        //初始化页面上面的按钮事件
        /*
         * 省级地址选择事件联动加载
         */
        $('#seltProvinceAreaID').change(function () {
            loadingAreasOptions(false, "seltProvinceAreaID", "seltCityAreaID");
        });
        /*
        * 市级地址选择联动加载
        */
        $('#seltCityAreaID').change(function () {
            loadingAreasOptions(false, "seltCityAreaID", "seltCistrictAreaID");
        });
        /*
        * 县/区级地址选择事件联动加载
        */
        $('#seltCistrictAreaID').change(function () {
            loadingAreasOptions(false, "seltCistrictAreaID", "seltStreetAreaID");
        });
        /*
         * 选择街道选择事件联动加载
         */
        $('#seltStreetAreaID').change(function () {
            loadingAreasOptions(false, "seltStreetAreaID");
        });

    };
    return oInit;
};